﻿Public Class frmDuLieuTamXoa

    Private Sub TrangChủToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrangChủToolStripMenuItem.Click
        Me.Close()
    End Sub
    Private Sub frmDuLieuTamXoa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dgvDuLieuTamXoa.DataSource = NhaThueBUS.GetAllNhaBUS_DaHuy()
    End Sub

    Private Sub XóaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles XóaToolStripMenuItem.Click
        Try

       
        If (dgvDuLieuTamXoa.SelectedRows.Count > 0) Then
            For i As Integer = 0 To dgvDuLieuTamXoa.SelectedRows.Count - 1
                Dim ma As Integer = Integer.Parse(dgvDuLieuTamXoa.SelectedRows(i).Cells(0).Value.ToString())
                NhaThueBUS.DeleteNhaBUS_DaHuy(ma)
            Next
        End If
            dgvDuLieuTamXoa.DataSource = NhaThueBUS.GetAllNhaBUS_DaHuy()
        Catch ex As Exception
            MessageBox.Show("Kết nối bị lỗi bạn vui lòng kiểm tra lại cơ sở dữ liệu và server")
        End Try
    End Sub

    Private Sub PhụcHồiToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PhụcHồiToolStripMenuItem.Click

        Try

            If (dgvDuLieuTamXoa.SelectedRows.Count > 0) Then
                For i As Integer = 0 To dgvDuLieuTamXoa.SelectedRows.Count - 1
                    Dim ma As Integer = Integer.Parse(dgvDuLieuTamXoa.SelectedRows(i).Cells(0).Value.ToString())
                    NhaThueBUS.RestoreNhaBUS_DaHuy(ma)
                Next
            End If
            dgvDuLieuTamXoa.DataSource = NhaThueBUS.GetAllNhaBUS_DaHuy()

        Catch ex As Exception
            MessageBox.Show("Kết nối bị lỗi bạn vui lòng kiểm tra lại cơ sở dữ liệu và server")
        End Try
    End Sub

   
End Class